//
//  EFShoppingInvalidClearCell.m
//  EnjogFood
//
//  Created by 张文瀚 on 2017/5/1.
//  Copyright © 2017年 wf. All rights reserved.
//

#import "EFShoppingInvalidClearCell.h"

@interface EFShoppingInvalidClearCell()
@property(nonatomic, strong)UIButton *clearBtn;
@end

@implementation EFShoppingInvalidClearCell


-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = RGBCOLOR(0xF5F9F9);
        self.backgroundColor = RGBCOLOR(0xF5F9F9);
        [self initView];
    }
    return self;
}

- (void)initView{
    [self.contentView addSubview:self.clearBtn];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.clearBtn.centerY = 34.f;
    self.clearBtn.centerX = kScreenWidth/2.f;
}

-(void)onClickClear{
    if(self.clearblock != NULL){
        self.clearblock();
    }
}

- (UIButton *)clearBtn{
    if (!_clearBtn) {
        _clearBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 128.f, 25.f)];
        [_clearBtn setTitle:@"清空失效购买商品" forState:UIControlStateNormal];
        [_clearBtn setTitleColor:RGBCOLOR(0x69BA45) forState:UIControlStateNormal];
        _clearBtn.titleLabel.font = [UIFont systemFontOfSize:13.f];
        _clearBtn.layer.borderWidth = 0.5f;
        _clearBtn.layer.borderColor = RGBCOLOR(0x69BA45).CGColor;
        _clearBtn.layer.cornerRadius = 5.f;
        _clearBtn.layer.masksToBounds = YES;
        [_clearBtn addTarget:self action:@selector(onClickClear) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _clearBtn;
}

@end
